package selfStudy.demo;

import java.util.Map;
import java.util.Properties;
import java.util.Set;

//properties对象
public class Test2 {
    public static void main(String[] args) {
        //Properties是一个map集合
        Properties pp = new Properties();
        //增
        pp.put("张三", 23);
        pp.put("李四", 23);
        pp.put("王五", 23);
        //System.out.println(pp);
        //删
        pp.remove("张三");
        //System.out.println(pp);
        //改
        pp.put("王五", 24);
        System.out.println(pp);
        //查
        Set<Map.Entry<Object, Object>> entries = pp.entrySet();
        for (Map.Entry<Object, Object> entry : entries) {
            System.out.println("通过键值对对象:"+entry.getKey() + "..." + entry.getValue());
        }
        Set<Object> objects = pp.keySet();
        for (Object o : objects) {
            System.out.println("根据键找值:"+o + "..." + pp.get(o));
        }
    }
}
